<template>
	<view class="">
		<view class="pwdhead">
			<view class="title">
				<view :class="titindex==''?'active':''" @click="settitindex('')"><text>全部</text></view>
				<view :class="titindex==1?'active':''" @click="settitindex(1)"><text>处理中</text></view>
				<view :class="titindex==2?'active':''" @click="settitindex(2)"><text>已处理</text></view>
			</view>
		</view>
		<view class="" style="height: 120rpx;"></view>
		<view class="listbg" v-if="list.length>0">
			<view class="listitem" @click="goinfo(item.refund_order_id)" v-for="(item,index) in list" :key="index">
				<view class="tit">
					<text>{{item.merchant.marketField.mar_name || '暂无'}}</text><text>{{getTitle(item.status,item.refund_type)}}</text>
				</view>
				<view class="goods goods2">
					<image :src="item.refundProduct[0].product.cart_info.product.image"></image>
					<view class="one">
						<text>{{item.refundProduct[0].product.cart_info.product.store_name || '暂无物品信息'}}</text>
						<text class="gray">下单时间: {{item.create_time || '暂无时间'}}</text>
					</view>
					<view class="price price2">
						<view class="">￥<text>{{item.refundProduct[0].product.product_price || '0'}}</text></view>
						<text>共{{item.refundProduct[0].product.product_num || '0'}}件</text>
					</view>
				</view>
				<view class="infos" v-if="item.status == -1"><text>{{item.fail_message || '暂无失败理由'}}</text></view>
			</view>
		</view>
		<view class="nomore" v-else>
			<block v-if="issearch">
				<image src="../static/icon_322@2x.png" mode=""></image>
				<text>抱歉，未能找到您搜索的商品</text>
			</block>
			<block v-else>
				<image src="../static/icon_294@2x.png" mode=""></image>
				<text>暂时没有任何帮买订单</text>
				<text>稍等一下再来吧</text>
			</block>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				visible: false,
				date: '',
				titindex: '',
				list: [],
				key: '',
			}
		},
		onLoad(e) {},
		onShow() {
			//获取订单列表
			this.getuserinfo();
		},
		watch: {
			//监听状态栏
			titindex(newValue) {
				this.list = [];
				this.getuserinfo();
			}
		},
		methods: {
			getTitle(type, index) {
				// 处理中
				if (type == 1 || type == 0 || type == 2) {
					switch (index) {
						case 1:
							return '处理中-退款';
						case 2:
							return '处理中-退款退货';
						case 3:
							return '处理中-退换货';
					}
				}
				// 已处理 审核未通过
				if (type == -1) {
					switch (index) {
						case 1:
							return '已处理-退款失败';
						case 2:
							return '已处理-退款退货失败';
						case 3:
							return '已处理-退换货失败';
					}
				}
				// 已处理 审核通过
				if (type == 3) {
					switch (index) {
						case 1:
							return '已处理-退款成功';
						case 2:
							return '已处理-退款退货成功';
						case 3:
							return '已处理-退换货成功';
					}
				}

			},
			//获取订单列表
			getuserinfo() {
				this.$request('mer/refund/order/list', {
					status: this.titindex,
					merLogin: '111'
				}, 'GET').then(res => {
					console.log(res, '订单列表');
					if (res.status == 200) {
						this.list = res.data;
					}
				})
			},
			switchtab(e) {
				uni.redirectTo({
					url: e
				})
			},
			settitindex(e) {
				this.titindex = e
			},
			onConfirm(e) {
				this.date = e.value[0] + ' - ' + e.value[1]
				console.log(e)
			},
			showtime() {
				this.visible = true
			},
			goinfo(id) {
				uni.navigateTo({
					url: "./orderinfo?id=" + id + '&type=2'
				})
			},
		}
	}
</script>

<style>
	.infos {
		width: 630rpx;
		height: 70rpx;
		background: #F7F7F7;
		font-size: 24rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 26rpx;
	}

	.infos>text {
		width: 592rpx;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}

	.titlebox {
		display: flex;
		width: 100%;
		height: 130rpx;
		align-items: center;
		box-sizing: border-box;
		padding-left: 30rpx;
		padding-right: 30rpx;

	}

	.searchbg {
		width: 450rpx;
		height: 68rpx;
		background: #F3F3F3;
		border-radius: 34rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		box-sizing: border-box;
		padding-left: 10rpx;
		padding-right: 10rpx;
	}

	.searchbg image {
		width: 30rpx;
		height: 30rpx;
	}

	.searchbg input {
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		width: 300rpx;
		color: #999999
	}

	.searchbg>.seah {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 120rpx;
		height: 60rpx;
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #FFFFFF;
		background: linear-gradient(64deg, #2BCCA5, #22B591);
		border-radius: 30rpx;
	}

	/* 	<view class="searchbg">
		<image src="" mode=""></image>
		<input type="text" placeholder="请输入关键字搜索" />
		<view class="">搜索</view>
	</view> */
	.pwdhead {
		position: fixed;
		top: 0;
	}

	.title {
		width: 750rpx;
		height: 100rpx;
		background: #FFFFFF;
		align-items: center;
		display: flex;
		justify-content: space-between;
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #666666;
		box-sizing: border-box;
		padding: 0 100rpx;
		border-radius: 20rpx 20rpx 0px 0px;
		/* position: fixed; */
		/* top: 0; */
		z-index: 4;
	}

	.active {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.active text {
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: bold;
		color: #333333;
	}

	.active::after {
		content: '';
		width: 50rpx;
		position: absolute;
		height: 8rpx;
		background: linear-gradient(64deg, #2BCCA5, #22B591);
		border-radius: 4rpx;
		top: 44rpx;
	}

	.listbg {
		width: 690rpx;
		margin-left: 30rpx;


	}

	.realpay {
		font-size: 24rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
		display: flex;
		justify-content: flex-end;
		align-items: baseline;
		margin-top: 6rpx;
	}

	.realpay text {
		font-size: 36rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
	}

	.goodsbtn {
		width: 100%;
		display: flex;
		justify-content: flex-end;
		margin-top: 20rpx;
	}

	.goodsbtn>view {
		width: auto;
		height: 60rpx;
		background: linear-gradient(64deg, #2BCCA5, #22B591);
		box-shadow: 0px 4rpx 6rpx 0px rgba(20, 187, 146, 0.4);
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 24rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #FFFFFF;
		box-sizing: border-box;
		padding-left: 34rpx;
		padding-right: 34rpx;
	}

	.goodsbtn>.white {
		background: #FFFFFF;
		font-size: 22rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
		box-shadow: none;
		border: 1rpx solid #CCCCCC;
		margin-right: 30rpx;

	}

	.listitem {
		width: 690rpx;
		height: auto;
		background: #FFFFFF;
		border-radius: 20rpx;
		margin-top: 30rpx;
		box-sizing: border-box;
		padding: 30rpx;
	}

	.tit {
		display: flex;
		justify-content: space-between;
		font-size: 26rpx;
		align-items: center;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
	}

	.tit text:nth-of-type(2) {
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #F83535;
	}

	.gray {
		font-size: 22rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #999999;
		margin-top: 10rpx;
	}

	.price2>view,
	.price2>view text {
		font-size: 26rpx !important;
		font-family: Microsoft YaHei;
		font-weight: 400 !important;
		color: #333333 !important;
	}

	.price2>text {
		margin-top: 4rpx;
		font-size: 22rpx !important;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #999999 !important;
	}

	.goods2>image {
		width: 140rpx;
		height: 140rpx;
		border-radius: 10rpx;
		/* background: #18BC37; */
		margin-right: 20rpx;

	}

	.one {
		display: flex;
		flex-direction: column;
	}

	.one>text:nth-of-type(1) {
		width: 280rpx;
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
		line-height: 36rpx
	}

	.goods {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 12rpx;
	}

	.price {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		font-size: 24rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #F83535;
	}

	.price>view text {
		font-size: 36rpx;

		font-weight: bold;

	}

	.price>text {
		font-size: 22rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #333333;
	}

	.listitem:first-child {
		margin-top: 0;
	}

	.imgbg {
		display: flex;
		align-items: center;
	}

	.imgbg .dian {
		width: 30rpx;
		height: 8rpx;
	}

	.imgbg image {
		width: 100rpx;
		height: 100rpx;
		border-radius: 10rpx;
		/* background: #18BC37; */
		margin-right: 10rpx;
	}

	page {
		background: #F5F5F5;
	}

	.box {
		width: 750rpx;
		height: 170rpx;
		overflow: hidden;
		background: linear-gradient(180deg, #109C7A 0%, #109C7A 100%);
		position: relative;
		/* 	display: flex;
		align-items: center; */
	}

	.box>.line {
		width: 100%;
		height: 40rpx;
		border-radius: 20rpx 20rpx 0px 0px;
		position: absolute;
		bottom: 0;
		background: #F5F5F5;
	}

	.timesc {
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		margin-left: 20rpx;



	}

	.timesc>text {
		width: 190rpx;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}

	.timesc image {
		width: 36rpx;
		height: 36rpx;
		margin-left: 2rpx;
	}

	.nomore {
		display: flex;
		flex-direction: column;
		align-items: center;
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #666666;
		overflow: hidden;
	}

	.nomore image {
		width: 306rpx;
		height: 352rpx;
		margin-top: 90rpx;
	}

	.nomore text:nth-of-type(1) {
		font-size: 34rpx;
		font-family: Microsoft YaHei;
		font-weight: bold;
		color: #333333;
		margin-bottom: 30rpx;
	}

	.nomore>view {
		font-size: 32rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #FFFFFF;
		width: 300rpx;
		height: 100rpx;
		background: linear-gradient(64deg, #2BCCA5, #22B591);
		box-shadow: 0px 4rpx 6rpx 0px rgba(20, 187, 146, 0.4);
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 130rpx;
	}
</style>
